package bb.lanxing.model.json;

import java.io.Serializable;

import com.alibaba.fastjson.annotation.JSONType;
import com.baidu.mapapi.model.LatLng;

import android.os.Parcel;
import android.os.Parcelable;

@JSONType(ignores = { "latE6", "lngE6" })
public class RoutePoint implements Cloneable, Parcelable, Serializable {
    public static final Creator<RoutePoint> CREATOR = new Creator<RoutePoint>() {
        @Override
        public RoutePoint createFromParcel(Parcel parcel) {
            return new RoutePoint(parcel);
        }

        @Override
        public RoutePoint[] newArray(int i) {
            return new RoutePoint[i];
        }
    };
    private double lat;
    private double lng;

    public RoutePoint() {
    }

    public RoutePoint(LatLng latLng) {
        this.lat = latLng.latitude;
        this.lng = latLng.longitude;
    }

    public RoutePoint(double d, double d2) {
        this.lat = d;
        this.lng = d2;
    }

    protected RoutePoint(Parcel parcel) {
        this.lat = parcel.readDouble();
        this.lng = parcel.readDouble();
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public LatLng toLatLng() {
        return new LatLng(this.lat, this.lng);
    }

    public double getLat() {
        return this.lat;
    }

    public void setLat(double d) {
        this.lat = d;
    }

    public double getLng() {
        return this.lng;
    }

    public void setLng(double d) {
        this.lng = d;
    }

    public int getLatE6() {
        return (int) (this.lat * 1000000.0d);
    }

    public int getLngE6() {
        return (int) (this.lng * 1000000.0d);
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        parcel.writeDouble(this.lat);
        parcel.writeDouble(this.lng);
    }
}
